
#https://blog.csdn.net/sinat_31608641/article/details/121666011
#https://blog.csdn.net/zj1131190425/article/details/125792572

# requirments
cmake_minimum_required(VERSION 3.12.0)

# set compiler
SET(CMAKE_C_COMPILER /usr/bin/gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/g++)

# c++ standard
#set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)

# set compiler params 
set(CMAKE_C_FLAGES "${CMAKE_CXX_FLAGES}")
set(CMAKE_CXX_FLAGES "${CMAKE_CXX_FLAGES} -std=c++17")

#message("$ENV{CFLAGS}") #C compiler params
#message("$ENV{CXXFLAGS}") #C++ compiler params

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_C_FLAGES_DEBUG "$ENV{CFLAGS}")
set(CMAKE_CXX_FLAGES_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
#set(CMAKE_BUILD_TYPE "release")
set(CMAKE_C_FLAGES_RELEASE "$ENV{CFLAGS}")
set(CMAKE_CXX_FLAGES_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

# project info
project(test)

# srd
aux_source_directory(. DIR_SRCS)

find_package(OpenMP REQUIRED)

# execute target
add_executable(test main1.cpp message.pb.cc)

# add so library
# https://blog.csdn.net/liyuanbhu/article/details/131673628
target_link_libraries(test 
  PUBLIC OpenMP::OpenMP_CXX
  -lz
  -lprotobuf
  -lsqlite3
  -pthread)